<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>故障诊断系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand" href="{{ url_for('main.index') }}">故障诊断系统</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link active" href="{{ url_for('main.index') }}">主页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('training.index') }}">模型训练</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('inference.index') }}">故障诊断</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for('data.index') }}">数据管理</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <div class="container mt-4">
        <div class="row">
            <!-- 系统状态卡片 -->
            <div class="col-md-6 mb-4">
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">系统状态</h5>
                    </div>
                    <div class="card-body">
                        <div class="d-flex justify-content-between align-items-center mb-3">
                            <span>模型状态:</span>
                            <span class="badge bg-{{ 'success' if model_exists else 'warning' }}">
                                {{ '已训练' if model_exists else '未训练' }}
                            </span>
                        </div>
                        <div class="d-flex justify-content-between align-items-center">
                            <span>可用数据集:</span>
                            <span class="badge bg-info">{{ datasets|length }}</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 快速操作卡片 -->
            <div class="col-md-6 mb-4">
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">快速操作</h5>
                    </div>
                    <div class="card-body">
                        <div class="d-grid gap-2">
                            <a href="{{ url_for('training.index') }}" class="btn btn-primary">
                                开始训练模型
                            </a>
                            <a href="{{ url_for('inference.index') }}" class="btn btn-success">
                                进行故障诊断
                            </a>
                            <a href="{{ url_for('data.index') }}" class="btn btn-info">
                                管理数据集
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 系统说明 -->
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <h5 class="card-title mb-0">系统说明</h5>
                    </div>
                    <div class="card-body">
                        <h5>功能介绍</h5>
                        <ul>
                            <li>模型训练：上传数据集并训练故障诊断模型</li>
                            <li>故障诊断：使用训练好的模型进行故障诊断</li>
                            <li>数据管理：管理和预览数据集</li>
                        </ul>
                        
                        <h5>使用流程</h5>
                        <ol>
                            <li>在"数据管理"中上传故障数据集</li>
                            <li>在"模型训练"中选择数据集并训练模型</li>
                            <li>在"故障诊断"中输入数据进行诊断</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="footer mt-5 py-3 bg-light">
        <div class="container text-center">
            <span class="text-muted">故障诊断系统 &copy; 2024</span>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
</body>
</html> 